
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.datadump.biz.convertor.*;
import com.joysuch.wwyt.datadump.biz.processor.MajorHazardImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.MhMajorHazardDumpQueryBean;
import com.joysuch.wwyt.mh.entity.dsl.QMhMajorHazard;
import com.joysuch.wwyt.risk.entity.dsl.QRiskDistrict;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@DataDumpEntity(name = "mh-major-hazard-dump", entity = QMhMajorHazard.class, exportQueryConditions = MhMajorHazardDumpQueryBean.class,
        businessName = "危险源", batchDeleteField = "state", deleteFlagValue = "44", importProcessors = MajorHazardImportProcessor.class)
@Data
public class MhMajorHazardDumpBean {

    @NotNull
    @Length(max = 64)
    @Excel(name = "危险源编号", width = 15, needMerge = true)
    @DataDumpField(field = "code", importKey = true)
    private String code;

    @NotNull
    @Length(max = 64)
    @Excel(name = "危险源名称", width = 25, needMerge = true)
    @DataDumpField(field = "name")
    private String name;

    @NotNull
    @Length(max = 64)
    @Excel(name = "所在风险区域编号", width = 20, needMerge = true)
    @DataDumpField(field = "riskDistrictId", referenceEntity = QRiskDistrict.class, referenceEntityField = "code")
    private String riskDistrictCode;

    @Length(max = 64)
    @Excel(name = "所在风险区域名称", width = 25, needMerge = true)
    @DataDumpField(field = "riskDistrictId", referenceEntity = QRiskDistrict.class, referenceEntityField = "name", importIgnore = true)
    private String riskDistrictName;

    @Length(max = 512)
    @Excel(name = "危险源描述", width = 20, needMerge = true)
    @DataDumpField(field = "description")
    private String description;

    @Excel(name = "防雷防静电设施是否定期接受检测", width = 30, needMerge = true)
    @DataDumpField(field = "antiThunderFacilityPeriodlyChecked", exportConvertors = { ExportYesNoConvertor.class }, importConvertors = ImportYesNoToYNConvertor.class)
    private String antiThunderFacilityPeriodlyChecked;

    @Excel(name = "与危险源最近距离(m)", width = 20, needMerge = true)
    @DataDumpField(field = "minDistance")
    private Integer minDistance;

    @Excel(name = "危险源周边安全距离(m)", width = 20, needMerge = true)
    @DataDumpField(field = "surroundingSafeDistance")
    private Integer surroundingSafeDistance;


    @Excel(name = "危险源主要负责人", width = 20, needMerge = true)
    @DataDumpField(field = "responsibleUserId", exportConvertors = ExportMhMajorHazardUserConvertor.class, importConvertors = ImportMhMajorHazardUserConvertor.class)
    private String responsibleUserCode;

    @Excel(name = "危险源技术负责人", width = 20, needMerge = true)
    @DataDumpField(field = "technologyUserId", exportConvertors = ExportMhMajorHazardUserConvertor.class, importConvertors = ImportMhMajorHazardUserConvertor.class)
    private String technologyUserCode;

    @Excel(name = "危险源操作负责人", width = 20, needMerge = true)
    @DataDumpField(field = "operationUserId", exportConvertors = ExportMhMajorHazardUserConvertor.class, importConvertors = ImportMhMajorHazardUserConvertor.class)
    private String operationUserCode;

    @ExcelCollection(name = "危化品信息")
    @DataDumpField(field = "id", exportConvertors = ExportMhMajorHazardRelChemProductConvertor.class, importIgnore = true)
    private List<MhMajorHazardChemProductRelBean> chemProductRelBeanList;

    @Excel(name = "R值", width = 15, needMerge = true)
    @DataDumpField(field = "rvalue")
    private Double rvalue;

    @NotNull
    @Excel(name = "危险源等级", width = 15, needMerge = true)
    @DataDumpField(field = "level")
    private String level;

    @Excel(name = "危险源投用时间", width = 20, needMerge = true)
    @DataDumpField(field = "startUseTime")
    private String startUseTime;

    @NotNull
    @Excel(name = "填表人", width = 15, needMerge = true)
    @DataDumpField(field = "writtenBy")
    private String writtenBy;

    @Excel(name = "填表日期", width = 15, format = "yyyy-MM-dd", needMerge = true)
    @DataDumpField(field = "createTime")
    private Date createTime;

}
